module.define('Util', [], function () {
  return {
    sum(data, field) {
      return data.reduce((a, b) => a + b[field], 0)
    },
    avg() {
      console.log('@avg method')
    },
    order(data, field, type = 'asc') {
      return data.sort((a, b) => {
        return type == 'asc' ? a[field] - b[field] : b[field] - a[field]
      })
    },
    // remove(data, field) {
    //   data.splice(m, 1)
    //   return data
    // },
  }
})
